<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>制作合同</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table > tbody > tr > td {
            height: 24px;
            max-height: 24px;
            overflow: hidden;
            position: relative;
        }

        .jiu {
            position: absolute;
            width: 10px;
            height: 10px;
            top: 2px;
            right: 2px;
            background: url("/dist/img/jiu.png");
        }

        .moduleName {
            float: left;
            height: 27px;
            line-height: 27px;
            font-size: 22px;
            width: 100px;
            text-align: center;
        }

        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            /* top: 0; */
            right: 0;
            position: absolute;
            border-radius: 5px;
            margin-top: 1px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }

        .nav-tabs-custom {
            margin-bottom: 0;
            box-shadow: none;
            position: relative;
        }

        span.lineOne {
            line-height: 27px !important;
            height: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .table-detail td.twoLine {
            line-height: 1.5 !important;
            padding: 3px 0 !important;
        "
        }

        .table-detail select {
            text-indent: 0 !important;
            padding-left: 0 !important;
            margin-left: -4px !important;
        }

        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }

        .fixed-table_body tr:nth-of-type(odd) {
            background: #F9F9F9;
        }

        .gray td {
            color: #CCCCCC !important;
        }

    </style>
</head>
<body>
<section class="content" id="app">
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="div-td-content-more"><i></i></div>
    <div class="oaLoad">
        <div class="loadGif" id="areaProgress"></div>
    </div>
    <div class="templateStyle">
        <div class="nav-tabs-custom oaReportNav">
            <div style="height: 25px; margin-bottom: 10px;">
                <div class="pull-left" style="width: 110px;">
                    <select v-model="searchParams.companyId"
                            style="width: 100%;height: 25px;font-size: 12px;line-height: 25px;padding-top: 0px;padding-bottom: 0px;padding-left: 6px;border-color: #D2D6DE;">
                        <option value="">选择公司</option>
                        <option v-for="(item,i) in companyList" :value="item.id">
                            {{item.name?item.name:item.allName}}
                        </option>
                    </select>
                </div>
                <!--<input type="text" placeholder="客户名称" class="form-control pull-left input-sm"
                       style="width: 100px;margin-left: 10px;" v-model="searchParams.customerKey" id="txtParent">
                <input type="text" placeholder="制作人" class="form-control pull-left input-sm"
                       style="width: 100px; margin-left: 10px;" v-model="searchParams.createUserName"
                       id="regionManagerName">-->

                <div class="pull-left" style="width: 120px;margin-left: 10px;">
                    <select id="selectRole" v-model="searchParams.auditFlag"
                            style="    width: 100%;height: 25px;font-size: 12px;line-height: 25px;padding-top: 0px;padding-bottom: 0px;padding-left: 6px;border-color: #D2D6DE;">
                        <option value="">请选择审核状态</option>
                        <option value="0">审核中</option>
                        <option value="1">审核通过</option>
                        <option value="2">已驳回</option>
                        <option value="3">已作废</option>
                    </select>
                </div>
                <div class="pull-left" style="width: 120px;margin-left: 10px;">
                    <select id="selectNewOld" v-model="searchParams.newOrOld"
                            style="    width: 100%;height: 25px;font-size: 12px;line-height: 25px;padding-top: 0px;padding-bottom: 0px;padding-left: 6px;border-color: #D2D6DE;">
                        <option value="">请选择合同类别</option>
                        <option value="X">新机合同</option>
                        <option value="J">旧机合同</option>
                    </select>
                </div>
                <input type="text" placeholder="关键字" class="form-control pull-left input-sm"
                       style="width: 100px; margin-left: 10px;" v-model="searchParams.key" id="txtParent">
                <button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="search">
                    查询
                </button>
                <input type="button" value="制作销售合同" class="btn oaBtn btn-sm pull-right" @click="add()">
            </div>
        </div>
    </div>
    <div class="box-body no-padding iframeH3" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <div class="fixed-table-box head-fixed ">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                    <tr>
                        <th style="width:120px;">
                            <div class="table-cells">合同编号</div>
                        </th>
                        <th style="width:29px;">
                            <div class="table-cells">类别</div>
                        </th>
                        <th style="width:65px;">
                            <div class="table-cells">公司</div>
                        </th>
                        <th style="width:61px;">
                            <div class="table-cells">区域经理</div>
                        </th>
                        <th style="width:61px;">
                            <div class="table-cells">客户名称</div>
                        </th>
                        <th style="width:61px;">
                            <div class="table-cells">品牌</div>
                        </th>
                        <th style="width:61px;">
                            <div class="table-cells">设备类型</div>
                        </th>
                        <th style="width:75px;">
                            <div class="table-cells">机型</div>
                        </th>
                        <th style="width:130px;">
                            <div class="table-cells">序列号</div>
                        </th>
                        <th style="min-width: 75px;">
                            <div class="table-cells">销售价格(元)</div>
                        </th>
                        <th style="width:65px;">
                            <div class="table-cells">付款方式</div>
                        </th>
                        <th style="width:55px;">
                            <div class="table-cells">制作人</div>
                        </th>
                        <th style="width:96px;">
                            <div class="table-cells">审核状态</div>
                        </th>
                        <th style="width:61px;">
                            <div class="table-cells">附件上传</div>
                        </th>
                        <th style="width: 120px;">
                            <div class="table-cells">操作</div>
                        </th>
                        <th style="width: 17px;">
                            <div class="table-cells"></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
            <div class="fixed-table_body-wraper iframeFixed">
                <table class="fixed-table_body table-hover" cellspacing="0" cellpadding="0" border="0"
                       style="width: 100%;">
                    <tbody id="tbList">
                    <tr v-for="(item,i) in list.main" :class="item.auditFlag==3?'gray':''">
                        <td style="width:120px;"><span class="lineOne">{{item.contractNo}} </span>
                        </td>
                        <td style="width:29px;" v-if="item.contractType==1"><span>新</span></td>
                        <td style="width:29px;" v-else="item.contractType==2"><span>旧</span></td>
                        <td style="width:65px;"><span class="lineOne">{{item.seller}}</span></td>
                        <td style="width:61px;"><span  class="oa-name">{{item.regionManagerName}}</span></td>
                        <td class="td-tanZongStyle-line" @click="goDetail('查看',i)"
                            style="color:#2a8cec;cursor: pointer;width: 61px;">{{nameSub(item.buyer)}}
                        </td>
                        <td style="width:61px;"><span class="lineOne">{{item.brandName}}</span></td>
                        <td style="width:61px;">{{item.deviceType}}</td>
                        <td style="width:75px;"><span class="lineOne">{{item.modelName}}</span></td>
                        <td style="width:130px;">{{item.serialNo}}</td>
                        <td style="min-width: 75px;">{{fmoney(item.salesPrice)}}</td>
                        <td style="width:65px;">{{item.buyType=='融资租赁打包'?'融资租赁(打包)':item.buyType}}</td>
                        <td style="width:55px;"><span  class="oa-name">{{item.createUserName}}</span></td>
                        <td v-html="convertAuditFlagToName(item)" style="width:96px;"></td>
                        <td v-if=" item.haveUploadContract==1" style="width:61px;">完整
                        </td>
                        <td v-else style="width:61px;text-align: center;color: red;">不完整</td>
                        <td style="width:120px;">
                            <a href="javascript:void(0);" @click="goClick('审核',i)"
                               style="color:#2a8cec;cursor: pointer;text-align: center"
                               v-if="isCheck('审核',item)">审核</a>
                            <a style="text-align: center;color: #CCCCCC"
                               v-else>审核</a>
                            <a href="javascript:void(0);" @click="goClick('编辑',i)"
                               style="color:#2a8cec;cursor: pointer;text-align: center"
                               v-if="isCheck('编辑',item)">编辑</a>
                            <a style="text-align: center;color: #CCCCCC"
                               v-else>编辑</a>
                            <a href="javascript:void(0);" @click="goClick('下载',i)"
                               style="color:#2a8cec;cursor: pointer;text-align: center"
                               v-if="isCheck('下载',item)">下载</a>
                            <a style="text-align: center;color: #CCCCCC"
                               v-else>下载</a>
                            <a href="javascript:void(0);" @click="goClick('作废',i)"
                               style="color:#2a8cec;cursor: pointer;text-align: center"
                               v-if="isCheck('作废',item)">作废</a>
                            <a style="text-align: center;color: red"
                               v-else>作废</a>
                            <a href="javascript:void(0);" @click="goClick('驳回',i)"
                               style="color:#2a8cec;cursor: pointer;text-align: center"
                               v-if="isCheck('驳回',item)">驳回</a>
                            <a style="text-align: center;color: #CCCCCC"
                               v-else>驳回</a>
                            <a href="javascript:void(0);" @click="goClick('上传附件',i)"
                               style="color:#2a8cec;cursor: pointer;text-align: center"
                               v-if="isCheck('上传附件',item)">附件管理</a>
                            <a style="text-align: center;color: #CCCCCC"
                               v-else>附件管理</a>
                            <!--<a href="javascript:void(0);" @click="downMB(item.id)"-->
                               <!--style="color:#2a8cec;cursor: pointer;text-align: center">模版下载</a>-->
                        </td>
<!--                        <td class="tdMore" style="border-left: 0px;"></td>-->
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

    </div>
    <div class="oa-pager text-center" style="margin-top: 5px;">
        共
        <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
        <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
        <span class="oa-pager-button" id="first">首页</span>
        <span class="oa-pager-button" id="prev">上一页</span>
        <span class="oa-pager-button" id="next">下一页</span>
        <span class="oa-pager-button" id="last">尾页</span>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + 12 + "px",
                        "left": $(this).offset().left - 6,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    function refresh() {
        console.log('+++++++++' + $("#nowPage").text());
        $.wyui.page.getByPage();

    }

    var app = new Vue({
        el: '#app',
        data: {
            currentUser: getCurrentUser(),
            list: {
                main: [],
            },
            searchParams: {
                userId: $.wyui.page.urlParams.userId ? $.wyui.page.urlParams.userId : getCurrentUser().id,
                key: '',
                companyId: '',
                auditFlag: '',
                newOrOld: '',
                load: true,
            },
            companyList: [],
        },

        methods: {
            getHeight:function(){
                var H = $(window).height()
                var allHeight=$("#divMain").height();
                var tableHeight=$("#tableMain").height();
                console.log(allHeight)
                console.log(tableHeight)
                var flag= allHeight>=tableHeight?true:false
                console.log(flag)
                if (flag){
                    $('.tdMore').each(function(){
                        $(this).css('width','17px');
                    });
                }else{
                    $('.tdMore').each(function(){
                        $(this).css('width','0px');
                    });
                }
                $(".iframeSaleFixed").height(H - 106);
            },
            nameSub: function (name) {
                return name.substring(0, 4);
            },
            convertAuditFlagToName: function (item) {
                switch (item.auditFlag) {
                    case "-1":
                        return "未提交";
                        break;
                    case "0":
                        if (item.currentAuditorId == getCurrentUser().id) {
                            return "<span style='color:red;'>待-" + item.currentAuditorName + "-审核</span>";
                        } else {
                            return "待-" + item.currentAuditorName + "-审核";
                        }
                        break;
                    case "1":
                        return "已通过";
                        break;
                    case "2":
                        if (item.createUserId == getCurrentUser().id) {
                            return "<span style='color:red;'>已驳回</span>";
                        } else {
                            return "已驳回";
                        }
                        break;
                    case "3":
                        return "已作废";
                        break;
                    default :
                        break;
                }
            },
            goClick: function (type, i) {
                var that = this;
                if (type == '审核' || type == '编辑' || type == '下载' || type == '上传附件') {
                    this.goDetail(type, i);
                } else if (type == '驳回') {
                    this.audit(i);
                } else if (type == '作废') {
                    if (confirm('确认要作废吗？')) {
                        that.zuofei(i);
                    }
                } else if (type == '删除') {
                    if (confirm('确认要删除吗？')) {
                        that.remove(i);
                    }
                } else {

                }
            },
            isCheck: function (type, item) {
                var that = this;
                if (type == '审核') {
//                    return true;
                    if (item.auditFlag == '0' && item.currentAuditorId == that.searchParams.userId) {
                        return true;
                    } else {
                        return false;
                    }
                }
                if (type == '上传附件') {
//                    return true;
                    if (item.auditFlag == '1') {
                        return true;
                    } else {
                        return false;
                    }
                }
                if (type == '下载') {
//                    return true;
                    if (item.auditFlag == '1' && (item.createUserId == that.searchParams.userId || '201711271733404C9DA1461F2421F828' == that.searchParams.userId)) {
                        return true;
                    } else {
                        return false;
                    }
                }
                if (type == '编辑') {
//                    return true;
                    if ((item.auditFlag == '-1' || item.auditFlag == '2') && item.createUserId == that.searchParams.userId) {
                        return true;
                    } else {
                        return false;
                    }
                }
                if (type == '作废') {
//                    return true;
                    if ('201711271733404C9DA1461F2421F828' == that.searchParams.userId && item.auditFlag != '3') {
                        return true;
                    } else {
                        return false;
                    }
                }
                if (type == '驳回') {
                    if ('201711271733404C9DA1461F2421F828' == that.searchParams.userId && item.auditFlag != '3') {
                        return true;
                    } else {
                        return false;
                    }
                }
                if (type == '删除') {
//                    return true;
                    if ('201711271733404C9DA1461F2421F828' == that.searchParams.userId || item.auditFlag == '-1') {
                        return true;
                    }
                    if (item.auditFlag == '-1' && item.currentAuditorId == that.searchParams.userId) {
                        return true;
                    }
                }
            },
            goDetail: function (type, i) {
                top.closeTabByPageId("contractDetail");
                var that = this;
                var id = that.list.main[i].id;
                var buyType = that.list.main[i].buyType;
                var zhihuan = that.list.main[i].haveReplacement;
                var diankuan = that.list.main[i].haveRepayment;
                var regionManagerName = that.list.main[i].regionManagerName;
                var regionManagerId = that.list.main[i].regionManagerId;
                var companyId = that.list.main[i].sellerCompanyId;
                var contractType = that.list.main[i].contractType;
                var haveWarranty = that.list.main[i].haveWarranty;
                var matchesCard = that.matchesCard(that.list.main[i].buyerTaxNo);
                var condition = '?id=' + id + '&buyType=' + buyType + '&zhihuan=' + zhihuan + '&diankuan=' + diankuan
                    + '&regionManagerId=' + regionManagerId + '&regionManagerName=' + regionManagerName + '&contractType=' +
                    contractType + '&companyId=' + companyId + '&haveWarranty=' + haveWarranty + '&page=' + $("#nowPage").text();
                if (type == '审核' || type == '查看') {
                    that.seeNew(i, type, condition);
                }
                if (type == '编辑') {
                    condition += '&pageType=edit';
                    top.addTabs({
                        id: 'contractDetail',
                        title: '修改合同',
                        close: true,
                        url: 'apply/contractWyp/detail_new.html' + condition
                    });
                }
                if (type == '下载') {
                    $('#ifExprot').attr('src', server.ip
                        + "/contractMainWyp/downDoc.json"
                        + '?contractId=' + id);
                    return false;
                }
                if (type == '上传附件') {
                    top.$.dialog({
                        content: 'url:/page/apply/contractWyp/uploadFile.html?contractId=' + id + '&buyType=' + buyType + '&contractType=' + contractType + '&matchesCard=' + matchesCard,
                        title: '上传附件',
                        width: 800,
                        height: 350,
                        max: true,
                        min: true,
                        lock: true
                    });
                    return false;
                }
            },
            downMB: function (id) {
                var that = this;
                $('#ifExprot').attr('src', server.ip
                    + "/contractMainWyp/downResumeDocWyp.json"
                    + '?contractId=' + id);
                return false;
            },
            seeNew: function (i, type, condition) {
                var that = this;
                condition += '&pageType=look';
                var id = that.list.main[i].id;
                var auditType = 'look';
                if (type == '审核') {
                    auditType = 'audit';
                }
                var haveHistory = false;
                $.wyui.postLoadMethod("/contractMainWyp/getHtmlHistory.json", {mainId: id}, function (r) {

                    if (r.result && r.result.html) {
                        haveHistory = true;
                    }
                    console.log(haveHistory)
                    if (haveHistory) {
                        top.addTabs({
                            id: 'contractDetail',
                            title: '合同详情',
                            close: true,
                            url: 'apply/contractWyp/detail_history.html' + condition + '&mainId=' + id + '&auditType=' + auditType,
                        });
                    } else {
                        top.addTabs({
                            id: 'contractDetail',
                            title: '合同详情',
                            close: true,
                            url: 'apply/contractWyp/detail_new.html' + condition
                        });
                    }

                }, false, true);
            } ,
            audit: function (i) {
                var that = this;
                var id = that.list.main[i].id;
                top.$.dialog({
                    content: 'url:/page/apply/contractWyp/copierReturnReason.html?id=' + id + "&pageType=0" + "&t=" + new Date(),
                    title: '填写驳回原因',
                    width: 300,
                    height: 200,
                    max: false,
                    min: false,
                    lock: true
                });
            } ,
            search: function () {
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams, trimRN(this.searchParams));
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
            add: function () {
                top.addTabs({id: 'zzht', title: '制作销售合同', close: true, url: 'apply/contractWyp/create.html'});
            },
            remove: function (i) {
                var that = this;
                var id = that.list.main[i].id;
                $.wyui.postLoadMethod('/contractMainWyp/remove.json', {'id': id}, function (r) {
                    if (r.records == true) {
                        alert('删除成功');
                        top.refreshTabByName("合同管理", "no", 'page=' + $("#nowPage").text());
                    } else {
                        alert('删除失败');
                    }
                }, false, true);
            },
            matchesCard: function (buyerTaxNo) {
                var buyerTaxNo = buyerTaxNo.toString();
                if (ChinaIdChecker(buyerTaxNo)) {
                    return true;
                } else {
                    return false;
                }
                //return b.length > 0 ? true : false;
            },
            zuofei: function (i) {
                var that = this;
                var id = that.list.main[i].id;
                $.wyui.postLoadMethod('/contractMainWyp/obsolete.json', {id: id, flag: '1'}, function (r) {
                    if (r.records == true) {
                        alert('作废成功');
                        // top.refreshTabByName("合同管理", "no", 'page=' + $("#nowPage").text());
                        that.search();
                    } else {
                        alert('作废失败');
                    }
                }, false, true);
            },
            fmoney: function (s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            }
        },
        mounted: function () {
            var that = this;
            $.wyui.postLoadMethod("/company/getCompanyListByUserId.json", {userId: getCurrentUser().id}, function (data) {
                that.companyList = data;
            }, false, false);
        }
    });
    //分页
    $.wyui.page.dataUrl = server.ip + "/contractMainWyp/selectMainList.json";
    $.wyui.page.queryParams.pageType = $.wyui.page.urlParams.pageType;
    $.wyui.page.queryParams.load = true;
    $.wyui.page.queryParams.userId = $.wyui.page.urlParams.userId ? $.wyui.page.urlParams.userId : getCurrentUser().id;
    $.extend($.wyui.page.queryParams);
    if ($.wyui.page.urlParams.page) {
        console.log($.wyui.page.queryParams.requestPage, $.wyui.page.urlParams.page)
        $.wyui.page.queryParams.requestPage = $.wyui.page.urlParams.page;
    }
    $.wyui.page.getByPage_callback = function (r) {
        app.list.main = r;
        document.getElementById("scrollDiv").scrollTop = 0;
        setTimeout(function () {
            app.getHeight();
        },10)
        app.getHeight();
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };
    $(function () {
        $("#txtParent").autoComplete({
            url: server.ip + urlConfig.contractWyp.getContractBuyer,
            render: function (r, panel) {
                for (var i = 0; i < r.length; i++) {
                    $("<li></li>").data("autoComplete",
                        r[i]).html("<a>" + r[i].customerName + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + r[i].customerTel + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (r) {
                //app.searchParams.customerKeyId = r.customerId;
                app.searchParams.key = r.customerName;
                return false;
            },
            extraParams: {createUserId: getCurrentUser().id},
            height: 210,
            width: 300
        })
    });
</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
</body>
</html>